package com.ty.service;

import com.ty.dao.InventoryDao;
import io.seata.spring.annotation.GlobalTransactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class InventoryService {

    @Autowired
    private InventoryDao inventoryDao;


    @GlobalTransactional(name = "coldCreteOrder")
   // @Transactional
    public void deduct(Integer productId, Integer optionQty) {
        inventoryDao.deduct(productId, optionQty);

        int i =5/0;
        inventoryDao.log(productId, optionQty);
    }
}
